package com.dulichdanang.location.locationCat;

import java.util.List;

import lib.map.MyMedia;

import com.dulichdanang.R;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LocationCatAdapter extends BaseAdapter {

	LayoutInflater inflater;
	List<LocationCat> items;
	public LocationCatAdapter(Activity _context, List<LocationCat> _list){
		super();
		this.items = _list;
		this.inflater = (LayoutInflater)_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return items.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		LocationCat item = items.get(position);
    	View vi=convertView;       
        if(convertView==null)
            vi = inflater.inflate(com.dulichdanang.R.layout.listitem_location_cat, null);
        ImageView imageThum = (ImageView)vi.findViewById(com.dulichdanang.R.id.imgLoCat);
       	TextView txtName = (TextView)vi.findViewById(com.dulichdanang.R.id.txtLoCatName);
       	TextView txtSubTitle = (TextView)vi.findViewById(R.id.txtSubTitle);
        imageThum.setImageDrawable(item.image);
        txtName.setText(item.name);
        txtSubTitle.setText(item.subTitle);
        return vi;  
	}

}
